Unbounded Spigot Algorithms for the Digits of Pi
نویسنده
چکیده
Rabinowitz and Wagon call their algorithm a spigot algorithm, because it yields digits incrementally and does not reuse digits after they have been computed. The digits drip out one by one, as if from a leaky tap. In contrast, most algorithms for computing the digits of π execute inscrutably, delivering no output until the whole computation is completed. However, the Rabinowitz–Wagon algorithm has its weaknesses. In particular, the computation is inherently bounded: one has to commit in advance to computing a certain number of digits. Based on this commitment, the computation proceeds on an appropriate finite prefix of the infinite series (1). In fact, it is essentially impossible to determine in advance how big that finite prefix should be for a given number of digits—specifically, a computation that terminates with nines for the last few digits of the output is inconclusive, because there may be a “carry” from the first few truncated terms. Rabinowitz and Wagon suggest that “in practice, one might ask for, say, six extra digits, reducing the odds of this problem to one in a million” [8, p. 197], a not entirely satisfactory recommendation. Indeed, the implementation printed at the end of their paper is not quite right [1, p. 82], sometimes printing an incorrect last digit because the finite approximation of the infinite series is one term too short. We propose a different algorithm, based on the same series (1) for π but avoiding these problems. We also show the same technique applied to other characterizations of π. No commitment need be made in advance to the number of digits to be computed; given enough memory, the programs will generate digits ad infinitum. Once more (necessarily, in fact, given the previous property), the programs are spigot algorithms in Rabinowitz and Wagon’s sense: they yield digits incrementally and do not reuse them after producing them. Of course, no algorithm using a bounded amount of memory can generate a nonrepeating sequence such as the digits of π indefinitely, so we have to allow arbitrary-precision arithmetic, or some other manifestation of dynamic memory allocation. Like Rabinowitz and Wagon’s algorithm, our proposals are not competitive with state-of-the-art arithmetic-geometric mean algorithms for computing π
منابع مشابه
Unbounded Spigot Algorithms for the Digits of π
Rabinowitz and Wagon (in American Mathematical Monthly 102(3):195–203, 1995) present a spigot algorithm for computing the digits of π. A spigot algorithm yields its outputs incrementally, and does not reuse them after producing them. Their algorithm is inherently bounded ; it requires a commitment in advance to the number of digits to be computed, and in fact might still produce an incorrect la...
متن کاملA Thorough Comparative Analysis of PI and Sliding Mode Controllers in Permanent Magnet Synchronous Motor Drive Based on Optimization Algorithms
In this paper, the speed tracking for permanent magnet synchronous motor (PMSM) in field oriented control (FOC) method is investigated using linear proportional-integral (PI) controller, sliding mode controller (SMC) and its advanced counterparts. The advanced SMCs considered in this paper are fuzzy SMC (FSMC) and sliding mode controller with time-varying switching gain (SMC+TG) which can effec...
متن کاملDistant decimals of $\pi$
We describe how to compute very far decimals of π and how to provide formal guarantees that the decimals we compute are correct. In particular, we report on an experiment where 1 million decimals of π and the billionth hexadecimal (without the preceding ones) have been computed in a formally verified way. Three methods have been studied, the first one relying on a spigot formula to obtain at a ...
متن کاملPi Fractions for Generating Uniformly Distributed Sampling Points in Global Search and Optimization Algorithms
π Fractions are used to create deterministic uniformly distributed pseudorandom decision space sample points for a global search and optimization algorithm. These fractions appear to be uniformly distributed on [0,1] and can be used in any stochastic algorithm rendering it effectively deterministic without compromising its ability to explore the decision space. π Fractions are generated using t...
متن کاملSolving Fractional Programming Problems based on Swarm Intelligence
This paper presents a new approach to solve Fractional Programming Problems (FPPs) based on two different Swarm Intelligence (SI) algorithms. The two algorithms are: Particle Swarm Optimization, and Firefly Algorithm. The two algorithms are tested using several FPP benchmark examples and two selected industrial applications. The test aims to prove the capability of the SI algorithms to s...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- The American Mathematical Monthly
دوره 113 شماره
صفحات -
تاریخ انتشار 2006